-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Battleground script command expansion #1534
Conversation
* bg_join - join battleground without npc chat room * bg_create - create a battle group without npc chat room
if( (bg_id = bg_create(mapindex, x, y, ev, dev)) == 0 ) | ||
{ // Creation failed | ||
script_pushint(st,0); | ||
return SCRIPT_CMD_SUCCESS; | ||
} | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bonus tab?
if(script_hasdata(st,6)) | ||
dev = script_getstr(st,6); // Die Event | ||
|
||
if (ev[0] != '\0') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be removed since it's done inside the function
* adjusted script return value to true/false * actually made events optional
Thanks to @Lemongrass3110 for pointing out my mistake
* corrected documentation. Thanks to @aleos89
if (script_hasdata(st, 3)) { | ||
map_name = script_getstr(st, 3); | ||
if ((mapindex = mapindex_name2id(map_name)) == 0) | ||
return SCRIPT_CMD_SUCCESS; // Invalid Map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
script_pushint missing here
* Removed two extra tabs.
y = bg->y; | ||
} | ||
|
||
if ((sd = script_charid2sd(6, sd)) == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got this while compiling:
script.c: In function 'buildin_bg_join':
script.c:18801:10: warning: assignment makes pointer from integer without a cast [enabled by default]
Also, bg_join crashes the map server, probably it is caused by this.
This is the code that I've been using to test the new commands:
prontera,155,180,0 script bg#bg_join 666,{
OnInit:
waitingroom "BG Test",2;
end;
}
bat_room,1,1,0 script Flavius Init -1,{
OnInit:
bindatcmd "bgjoin","Flavius Init::OnBGJoin";
bindatcmd "bgcreate","Flavius Init::OnBGCreate";
bindatcmd "bgleave","Flavius Init::OnBGLeave";
bindatcmd "bgdestroy","Flavius Init::OnBGDestroy";
bindatcmd "bgwp","Flavius Init::OnBGWp";
bindatcmd "bgchatjoin","Flavius Init::OnBGChatJoin";
end;
OnBGJoin:
bg_join($@FlaviusBG1_id1,"bat_b01",390,10,getcharid(0));
end;
OnBGCreate:
$@FlaviusBG1_id1 = bg_create("bat_b01",390,10);
end;
OnBGLeave:
bg_leave;
end;
OnBGDestroy:
if ($@FlaviusBG1_id1){
bg_destroy ($@FlaviusBG1_id1);
}
end;
OnBGWp:
bg_warp $@FlaviusBG1_id1,"bat_b01",390,10;
end;
OnBGChatJoin:
waitingroom2bg_single($@FlaviusBG1_id1,"bat_b01",390,10,"bg#bg_join");
end;
}
bg_create successfully creates the BG group and attach the respawn coordinates to the battle group, I've tested this by waitingroom2bg_single since bg_join crashes map server.
y = bg->y; | ||
} | ||
|
||
if ((script_charid2sd(6, sd)) == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
script.c: In function 'buildin_bg_join':
script.c:18801:32: warning: comparison between pointer and integer [enabled by default].
Works fine though 👍
This PR allows the script engine to create an instance of battleground group and attach a player to a battleground group without depending on chat room.
I think this will open possibilities for many ideas.